/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package todomanager.data;

/**
 * Standard task for Todo items
 *
 *
 * @author jonasbirgersson
 *
 */
public class StandardTask implements ITask {

    String name;
    String description;
    String dueDate;
    String category;
    int priority;
    int progress;
    boolean done;
    int keyID;

    /**
     * Standard Constructor for reating a task
     * @param name
     * @param description
     * @param dueDate
     * @param category
     * @param priority
     * @param progress
     * @param status
     */
    public StandardTask(String name, String description, String dueDate,
            String category, int priority, int progress, boolean status) {
        super();
        this.name = name;
        this.description = description;
        this.dueDate = dueDate;
        this.category = category;
        this.priority = priority;
        this.progress = progress;
        this.done = status;
    }
    
    @Override
    public String getName() {
        // TODO Auto-generated method stub
        return name;
    }

    @Override
    public void setName(String name) {
        this.name = name;

    }

    @Override
    public String getDescription() {
        return description;
    }

    @Override
    public void setDescription(String description) {
        this.description = description;

    }

    public String getDueDate() {
        return dueDate;
    }

    public void setDueDate(String dueDate) {
        this.dueDate = dueDate;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public int getPriority() {
        return priority;
    }

    public void setPriority(int priority) {
        this.priority = priority;
    }
    
    public int getProgress() {
        return progress;
    }

    public void setProgress(int progress) {
        this.progress = progress;
    }    

    public boolean isDone() {
        return done;
    }

    public void setDone(boolean done) {
        this.done = done;
    }
    
    

    @Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((category == null) ? 0 : category.hashCode());
		result = prime * result
				+ ((description == null) ? 0 : description.hashCode());
		result = prime * result + (done ? 1231 : 1237);
		result = prime * result + ((dueDate == null) ? 0 : dueDate.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result + priority;
		result = prime * result + progress;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		StandardTask other = (StandardTask) obj;
		if (category == null) {
			if (other.category != null)
				return false;
		} else if (!category.equals(other.category))
			return false;
		if (description == null) {
			if (other.description != null)
				return false;
		} else if (!description.equals(other.description))
			return false;
		if (done != other.done)
			return false;
		if (dueDate == null) {
			if (other.dueDate != null)
				return false;
		} else if (!dueDate.equals(other.dueDate))
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (priority != other.priority)
			return false;
		if (progress != other.progress)
			return false;
		return true;
	}

	@Override
    public String toString() {
        return "StandardTask [name=" + name + ", description=" + description
                + ", dueDate=" + dueDate + ", category=" + category
                + ", priority=" + priority + ",  progress=" + progress + ", done=" + done + "]";
    }

	@Override
	public void setKey(int keyID) {
		this.keyID = keyID;
		
	}
	
	@Override
	public int getKey(){
		return keyID;
	}
}
